/*
 * @Author: jiejie
 * @Github: https://github.com/jiejieTop
 * @Date: 2019-12-23 19:26:27
 * @LastEditTime: 2020-04-25 08:44:24
 * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
 */
#include "platform_thread.h"
#include "platform_memory.h"
#include "pthread.h"

platform_thread_t *platform_thread_init(const char *name,
                                        void *(entry)(void *),
                                        void *const param,
                                        unsigned int stack_size,
                                        unsigned int priority,
                                        unsigned int tick)
{
    platform_thread_t *thread;
    int res;

    thread = platform_memory_alloc(sizeof(platform_thread_t));
    if (NULL == thread)
    {
        return NULL;
    }

    res =  pthread_create((pthread_t *)thread, NULL, entry, param);
    if (res != 0)
    {
        return NULL;
    }
    else
    {
        return thread;
    }
}

void platform_thread_startup(platform_thread_t *thread)
{
}

void platform_thread_stop(platform_thread_t *thread)
{
}

void platform_thread_start(platform_thread_t *thread)
{
}

void platform_thread_destroy(platform_thread_t *thread)
{
    platform_memory_free(thread);
}


